﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using WCFSample.Contracts;

namespace WCFSample.Client
{
    class Program
    {
        static void Main(string[] args)
        {
            //CalculatorServiceClient client = new CalculatorServiceClient();
            //double d = client.Add(1, 2);
            //Console.WriteLine(d);
            using (ChannelFactory<ICalculator> channelFactory = new ChannelFactory<ICalculator>("CalculatorServiceTcp"))
            {
                ICalculator proxy = channelFactory.CreateChannel();
                using (proxy as IDisposable)
                {
                    Console.WriteLine("x + y = {2} when x = {0} and y = {1}",1,4,proxy.Add(1,4));
                }
            }
            Console.Read();
        }
    }
}
